<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  ~ Copyright (c) 2018. QDU 2015 Java1 Team CompilationError
  --%>

<%--
  Created by IntelliJ IDEA.
  User: inkux
  Date: 2018/5/25
  Time: 14:58
--%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<html>
<head>
	<title>Departments</title>
	<%@include file="../resources/js_css_includes.jsp" %>
	<script src="${pageContext.request.contextPath}/js/department_manager.js"></script>
</head>
<body>
<%@include file="../resources/navigation_header.jsp" %>
<%@include file="../resources/jsp_body_preludes.jsp" %>
<div class="table_div_forall">
	<table id="departments_data_table">
	<thead>
	<tr>
		<%--TODO Batch Delete--%>
		<th>#</th>
		<th>Name</th>
		<th>Description</th>
		<th>Operations</th>
	</tr>
	</thead>
	<tbody>

	<c:forEach var="dsgn" items="${depts}">
		<tr>
			<td>${dsgn.id}</td>
			<td>${dsgn.name}</td>
			<td>${dsgn.description}</td>
			<c:if test="${permissions.modifyDepartment}">
				<td><a href="javascript:confirmDelete(${dsgn.id});">Delete</a>
					<a target="_blank"
					   href="${pageContext.request.contextPath}/admin/modify_department?deptId=${dsgn.id}">Modify</a>
				</td>
			</c:if>
		</tr>
	</c:forEach>
	</tbody>
	</table>
	<script>
		$().ready(function () {
			$("#departments_data_table").DataTable();
		})
	</script>
	<a class="btn_color2" href="${pageContext.request.contextPath}/admin/new_department">New Department</a>
</div>
</body>
</html>
